this.parent({ shellReactive: true,
styleClass: 'login-dialog',
parentActor: parentActor,
- keybindingMode: Main.KeybindingMode.LOGIN_SCREEN,
+ keybindingMode: Shell.KeyBindingMode.LOGIN_SCREEN,
shouldFadeIn: false });
this.connect('destroy',
Lang.bind(this, this._onDestroy));
Main.wm.addKeybinding('toggle-recording',
this._bindingSettings,
Meta.KeyBindingFlags.NONE,
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._toggleRecorder));
},
if (this._open)
return;
- if (!Main.pushModal(this._entry, { keybindingMode: Main.KeybindingMode.LOOKING_GLASS }))
+ if (!Main.pushModal(this._entry, { keybindingMode: Shell.KeyBindingMode.LOOKING_GLASS }))
return;
this._notebook.selectIndex(0);
const OVERRIDES_SCHEMA = 'org.gnome.shell.overrides';
const DEFAULT_BACKGROUND_COLOR = Clutter.Color.from_pixel(0x2e3436ff);
-const KeybindingMode = {
- NONE: 0, // block all keybindings
- NORMAL: 1 << 0, // window mode
- OVERVIEW: 1 << 1,
- LOCK_SCREEN: 1 << 2,
- UNLOCK_SCREEN: 1 << 3,
- LOGIN_SCREEN: 1 << 4,
- MESSAGE_TRAY: 1 << 5,
- SYSTEM_MODAL: 1 << 6,
- LOOKING_GLASS: 1 << 7,
- ALL: ~0,
-};
-
let componentManager = null;
let panel = null;
let overview = null;
let shellMountOpDBusService = null;
let screenSaverDBus = null;
let modalCount = 0;
-let keybindingMode = KeybindingMode.NORMAL;
+let keybindingMode = Shell.KeyBindingMode.NORMAL;
let modalActorFocusStack = [];
let uiGroup = null;
let magnifier = null;
function _sessionUpdated() {
wm.setCustomKeybindingHandler('panel-main-menu',
- KeybindingMode.NORMAL |
- KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
sessionMode.hasOverview ? Lang.bind(overview, overview.toggle) : null);
- wm.allowKeybinding('overlay-key', KeybindingMode.NORMAL |
- KeybindingMode.OVERVIEW);
+ wm.allowKeybinding('overlay-key', Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW);
wm.setCustomKeybindingHandler('panel-run-dialog',
- KeybindingMode.NORMAL |
- KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
sessionMode.hasRunDialog ? openRunDialog : null);
if (sessionMode.isGreeter)
screenShield.showDialog();
* - options: Meta.ModalOptions flags to indicate that the pointer is
* already grabbed
*
- * - keybindingMode: used to set the current Main.KeybindingMode to filter
+ * - keybindingMode: used to set the current Shell.KeyBindingMode to filter
* global keybindings; the default of NONE will filter
* out all keybindings
*
function pushModal(actor, params) {
params = Params.parse(params, { timestamp: global.get_current_time(),
options: 0,
- keybindingMode: KeybindingMode.NONE });
+ keybindingMode: Shell.KeyBindingMode.NONE });
if (modalCount == 0) {
if (!global.begin_modal(params.timestamp, params.options)) {
global.stage.set_key_focus(null);
global.end_modal(timestamp);
global.set_stage_input_mode(Shell.StageInputMode.NORMAL);
- keybindingMode = KeybindingMode.NORMAL;
+ keybindingMode = Shell.KeyBindingMode.NORMAL;
throw new Error('incorrect pop');
}
global.end_modal(timestamp);
global.set_stage_input_mode(Shell.StageInputMode.NORMAL);
Meta.enable_unredirect_for_screen(global.screen);
- keybindingMode = KeybindingMode.NORMAL;
+ keybindingMode = Shell.KeyBindingMode.NORMAL;
}
function createLookingGlass() {
this.idleMonitor = new GnomeDesktop.IdleMonitor();
this._grabHelper = new GrabHelper.GrabHelper(this.actor,
- { keybindingMode: Main.KeybindingMode.MESSAGE_TRAY });
+ { keybindingMode: Shell.KeyBindingMode.MESSAGE_TRAY });
this._grabHelper.addActor(this._summaryBoxPointer.actor);
this._grabHelper.addActor(this.actor);
if (Main.panel.statusArea.activities)
Main.wm.addKeybinding('toggle-message-tray',
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE,
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.MESSAGE_TRAY |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.MESSAGE_TRAY |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this.toggleAndNavigate));
Main.wm.addKeybinding('focus-active-notification',
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE,
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.MESSAGE_TRAY |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.MESSAGE_TRAY |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._expandActiveNotification));
this._sources = new Hash.Map();
params = Params.parse(params, { shellReactive: false,
styleClass: null,
parentActor: Main.uiGroup,
- keybindingMode: Main.KeybindingMode.SYSTEM_MODAL,
+ keybindingMode: Shell.KeyBindingMode.SYSTEM_MODAL,
shouldFadeIn: true });
this.state = State.CLOSED;
if (this._shown) {
if (!this._modal) {
if (Main.pushModal(this._overview,
- { keybindingMode: Main.KeybindingMode.OVERVIEW }))
+ { keybindingMode: Shell.KeyBindingMode.OVERVIEW }))
this._modal = true;
else
this.hide();
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
+const Shell = imports.gi.Shell;
const Signals = imports.signals;
const St = imports.gi.St;
const TweenerEquations = imports.tweener.equations;
}
if (!this._isModal) {
- Main.pushModal(this.actor, { keybindingMode: Main.KeybindingMode.LOCK_SCREEN });
+ Main.pushModal(this.actor, { keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
this._isModal = true;
}
lock: function(animate) {
if (!this._isModal) {
- Main.pushModal(this.actor, { keybindingMode: Main.KeybindingMode.LOCK_SCREEN });
+ Main.pushModal(this.actor, { keybindingMode: Shell.KeyBindingMode.LOCK_SCREEN });
this._isModal = true;
}
Main.wm.addKeybinding('switch-input-source',
new Gio.Settings({ schema: "org.gnome.desktop.wm.keybindings" }),
Meta.KeyBindingFlags.REVERSES,
- Main.KeybindingMode.ALL,
+ Shell.KeyBindingMode.ALL,
Lang.bind(this, this._switchInputSource));
this._keybindingActionBackward =
Main.wm.addKeybinding('switch-input-source-backward',
new Gio.Settings({ schema: "org.gnome.desktop.wm.keybindings" }),
Meta.KeyBindingFlags.REVERSES |
Meta.KeyBindingFlags.REVERSED,
- Main.KeybindingMode.ALL,
+ Shell.KeyBindingMode.ALL,
Lang.bind(this, this._switchInputSource));
this._settings = new Gio.Settings({ schema: DESKTOP_INPUT_SOURCES_SCHEMA });
this._settings.connect('changed::' + KEY_CURRENT_INPUT_SOURCE, Lang.bind(this, this._currentInputSourceChanged));
_init: function(parentActor) {
this.parent({ shellReactive: true,
styleClass: 'login-dialog',
- keybindingMode: Main.KeybindingMode.UNLOCK_SCREEN,
+ keybindingMode: Shell.KeyBindingMode.UNLOCK_SCREEN,
parentActor: parentActor
});
Main.wm.addKeybinding('toggle-application-view',
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE,
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._toggleAppsPage));
},
this._workspaceSwitcherPopup = null;
this.setCustomKeybindingHandler('switch-to-workspace-left',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-right',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-up',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-to-workspace-down',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-left',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-right',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-up',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('move-to-workspace-down',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW,
Lang.bind(this, this._showWorkspaceSwitcher));
this.setCustomKeybindingHandler('switch-applications',
- Main.KeybindingMode.NORMAL,
+ Shell.KeyBindingMode.NORMAL,
Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-group',
- Main.KeybindingMode.NORMAL,
+ Shell.KeyBindingMode.NORMAL,
Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-applications-backward',
- Main.KeybindingMode.NORMAL,
+ Shell.KeyBindingMode.NORMAL,
Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-group-backward',
- Main.KeybindingMode.NORMAL,
+ Shell.KeyBindingMode.NORMAL,
Lang.bind(this, this._startAppSwitcher));
this.setCustomKeybindingHandler('switch-windows',
- Main.KeybindingMode.NORMAL,
+ Shell.KeyBindingMode.NORMAL,
Lang.bind(this, this._startWindowSwitcher));
this.setCustomKeybindingHandler('switch-windows-backward',
- Main.KeybindingMode.NORMAL,
+ Shell.KeyBindingMode.NORMAL,
Lang.bind(this, this._startWindowSwitcher));
this.setCustomKeybindingHandler('switch-panels',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW |
- Main.KeybindingMode.LOCK_SCREEN |
- Main.KeybindingMode.UNLOCK_SCREEN |
- Main.KeybindingMode.LOGIN_SCREEN,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW |
+ Shell.KeyBindingMode.LOCK_SCREEN |
+ Shell.KeyBindingMode.UNLOCK_SCREEN |
+ Shell.KeyBindingMode.LOGIN_SCREEN,
Lang.bind(this, this._startA11ySwitcher));
this.setCustomKeybindingHandler('switch-panels-backward',
- Main.KeybindingMode.NORMAL |
- Main.KeybindingMode.OVERVIEW |
- Main.KeybindingMode.LOCK_SCREEN |
- Main.KeybindingMode.UNLOCK_SCREEN |
- Main.KeybindingMode.LOGIN_SCREEN,
+ Shell.KeyBindingMode.NORMAL |
+ Shell.KeyBindingMode.OVERVIEW |
+ Shell.KeyBindingMode.LOCK_SCREEN |
+ Shell.KeyBindingMode.UNLOCK_SCREEN |
+ Shell.KeyBindingMode.LOGIN_SCREEN,
Lang.bind(this, this._startA11ySwitcher));
this.addKeybinding('open-application-menu',
new Gio.Settings({ schema: SHELL_KEYBINDINGS_SCHEMA }),
Meta.KeyBindingFlags.NONE,
- Main.KeybindingMode.NORMAL,
+ Shell.KeyBindingMode.NORMAL,
Lang.bind(this, this._openAppMenu));
Main.overview.connect('showing', Lang.bind(this, function() {
removeKeybinding: function(name) {
if (global.display.remove_keybinding(name))
- this.allowKeybinding(name, Main.KeybindingMode.NONE);
+ this.allowKeybinding(name, Shell.KeyBindingMode.NONE);
},
allowKeybinding: function(name, modes) {
},
_filterKeybinding: function(shellwm, binding) {
- if (Main.keybindingMode == Main.KeybindingMode.NONE)
+ if (Main.keybindingMode == Shell.KeyBindingMode.NONE)
return true;
// There's little sense in implementing a keybinding in mutter and
// not having it work in NORMAL mode; handle this case generically
// so we don't have to explicitly allow all builtin keybindings in
// NORMAL mode.
- if (Main.keybindingMode == Main.KeybindingMode.NORMAL &&
+ if (Main.keybindingMode == Shell.KeyBindingMode.NORMAL &&
binding.is_builtin())
return false;
shell-gtk-embed.h \
shell-global.h \
shell-invert-lightness-effect.h \
+ shell-keybinding-modes.h \
shell-mobile-providers.h \
shell-mount-operation.h \
shell-network-agent.h \
--- /dev/null
+/**
+ * ShellKeyBindingMode:
+ * @SHELL_KEYBINDING_MODE_NONE: block keybinding
+ * @SHELL_KEYBINDING_MODE_NORMAL: allow keybinding when in window mode,
+ * e.g. when the focus is in an application window
+ * @SHELL_KEYBINDING_MODE_OVERVIEW: allow keybinding while the overview
+ * is active
+ * @SHELL_KEYBINDING_MODE_LOCK_SCREEN: allow keybinding when the screen
+ * is locked, e.g. when the screen shield is shown
+ * @SHELL_KEYBINDING_MODE_UNLOCK_SCREEN: allow keybinding in the unlock
+ * dialog
+ * @SHELL_KEYBINDING_MODE_LOGIN_SCREEN: allow keybinding in the login screen
+ * @SHELL_KEYBINDING_MODE_MESSAGE_TRAY: allow keybinding while the message
+ * tray is popped up
+ * @SHELL_KEYBINDING_MODE_SYSTEM_MODAL: allow keybinding when a system modal
+ * dialog (e.g. authentification or session dialogs) is open
+ * @SHELL_KEYBINDING_MODE_LOOKING_GLASS: allow keybinding in looking glass
+ * @SHELL_KEYBINDING_MODE_ALL: always allow keybinding
+ *
+ * Controls in which GNOME Shell states a keybinding should be handled.
+*/
+typedef enum {
+ SHELL_KEYBINDING_MODE_NONE = 0,
+ SHELL_KEYBINDING_MODE_NORMAL = 1 << 0,
+ SHELL_KEYBINDING_MODE_OVERVIEW = 1 << 1,
+ SHELL_KEYBINDING_MODE_LOCK_SCREEN = 1 << 2,
+ SHELL_KEYBINDING_MODE_UNLOCK_SCREEN = 1 << 3,
+ SHELL_KEYBINDING_MODE_LOGIN_SCREEN = 1 << 4,
+ SHELL_KEYBINDING_MODE_MESSAGE_TRAY = 1 << 5,
+ SHELL_KEYBINDING_MODE_SYSTEM_MODAL = 1 << 6,
+ SHELL_KEYBINDING_MODE_LOOKING_GLASS = 1 << 7,
+
+ SHELL_KEYBINDING_MODE_ALL = ~SHELL_KEYBINDING_MODE_NONE
+} ShellKeyBindingMode;
+